#include "sxs.h"
#include "config.h"

sxs::sxs()
{
    //加载瑟希斯资源
    m_sxs.load(SXS_PATH);

    //瑟希斯位置
    m_X=GAME_WIDTH;
    m_Y=0;

    //瑟希斯状态
    m_Free=true;

    //瑟希斯速度
    m_speed=SXS_SPEED;

    //瑟希斯边框
    m_Rect.setWidth(m_sxs.width());
    m_Rect.setHeight(m_sxs.height());
    m_Rect.moveTo(m_X,m_Y);
}

void sxs::updatePosition()
{
    //空闲不计算坐标
    if(m_Free)
        return;
    //不空闲向左移动,到左边界为止
    if(m_X>=0)
    {
        m_X-=m_speed;
        m_Rect.moveTo(m_X,m_Y);
    }
}
